class Solution {
public:
    int smallestRangeI(vector<int>& nums, int k)
    {
        ranges::sort(nums);
        return ((nums[nums.size() - 1] - k) - (nums[0] + k)) < 0 ? 0 : ((nums[nums.size() - 1] - k) - (nums[0] + k));
    }
};